---
layout: docs
page_title: Nomad volume specification
description: |-
  Learn about the Nomad volume specification. Review an example volume specification. Create and register Container Storage Interface (CSI) and dynamic host volumes. Define capability, mount options, topology requests, secrets, and parameters.
---

# Nomad volume specification

This page provides reference information for the Nomad volume
specification. Create and register Container Storage Interface (CSI) and dynamic
host volumes using the [`volume create`][] and [`volume register`][] commands
and the equivalent API endpoints. Define capability, mount options, topology
requests, secrets, and parameters.

Some attributes are only be supported by one volume type or the other, or a
specific operation, while others may have a different meaning for each action,
so read the documentation for each attribute carefully.

* [CSI volume specification][csi_spec]
* [Dynamic host volume specification][dhv_spec]

Provide the file as either HCL or JSON to the commands and as JSON to
the API.

This example HCL configuration is for a CSI volume.

```hcl
id           = "ebs_prod_db1"
namespace    = "default"
name         = "database"
type         = "csi"
plugin_id    = "ebs-prod"
snapshot_id  = "snap-12345" # or clone_id, see below
capacity_max = "200G"
capacity_min = "100G"

capability {
  access_mode     = "single-node-reader-only"
  attachment_mode = "file-system"
}

capability {
  access_mode     = "single-node-writer"
  attachment_mode = "file-system"
}

mount_options {
  fs_type     = "ext4"
  mount_flags = ["noatime"]
}

topology_request {
  required {
    topology { segments { "rack" = "R2" } }
    topology { segments { "rack" = "R1", "zone" = "us-east-1a"} }
  }
  preferred {
    topology { segments { "rack" = "R1", "zone" = "us-east-1a"} }
  }
}

secrets {
  example_secret = "xyzzy"
}

parameters {
  skuname = "Premium_LRS"
}
```

[`volume create`]: /nomad/commands/volume/create
[`volume register`]: /nomad/commands/volume/register
[csi_spec]: /nomad/docs/other-specifications/volume/csi
[dhv_spec]: /nomad/docs/other-specifications/volume/host
